# import inquirer as iq

#
# opt = {
#     'type': iq.Func.input,
#     'title': '\t test',
#     'name': 'first_name',
#     "msg": 'what is your name: ',
#     'data': [],
#     'color': [],
#     'icon': iq.Icon.CIRCLE
# }
# res = iq.prompt(opt)
# print(res)

res = [
    {
        'name': '苹果',
        'checked': True
    },
    {
        'name': '香蕉'
    },
    {
        'name': '鸭梨'
    },
    {
        'name': '橘子',
        'checked': True
    },
    {
        'name': '火龙果'
    },
    {
        'name': '车厘子',
        'checked': True
    },
    {
        'name': '椰子'
    },
    {
        'name': '菠萝'
    }
]


def fill_data():
    for item in res:
        if 'checked' not in item.keys():
            item['checked'] = False


def pager(data, page_num, page_size):
    return {
        'page_num': page_num,
        'total': len(data),
        'total_page_num': len(data) // page_size if len(data) % page_size == 0 else (len(data) // page_size + 1),
        'page_size': page_size,
        'data': data[(page_num - 1) * page_size:page_num * page_size]
    }


print(pager(res, page_num=2, page_size=3))
# fill_data(res)
# print(res)
#
# b = False
#
# print(bool(1 - b))
